using UnityEngine;

namespace NodeCanvas.DialogueTrees
{
	[AddComponentMenu("")]
	[Name("End")]
	[Description("End the dialogue in Success or Failure.\nNote: A Dialogue will anyway End in Succcess if it has reached a node with no out connections.")]
	public class DLGEndNode : DLGNodeBase
	{
		public enum EndState
		{
			Failure = 0,
			Success = 1
		}

		public EndState endState = EndState.Success;

		public override string nodeName
		{
			get
			{
				return "END";
			}
		}

		public override int maxOutConnections
		{
			get
			{
				return 0;
			}
		}

		protected override Status OnExecute()
		{
			base.DLGTree.currentNode = this;
			base.status = (Status)endState;
			base.DLGTree.StopGraph();
			return base.status;
		}
	}
}
